package com.xqh.study.netflixexampleuser.feign;

import com.xqh.study.orderserviceapi.api.OrderServiceApi;
import com.xqh.study.orderserviceapi.dto.OrderDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @ClassName OrderClient
 * @Description
 * @Author xuqianghui
 * @Date 2020/1/8 10:04
 * @Version 1.0
 */
@FeignClient(value = "order", path = "/api/order")
public interface OrderClient extends OrderServiceApi {

    /**
     * 如果用 @PathVariable 必须 写 name属性 否则会报错
     * 这是feign 跟 spring mvc 不一样的地方.
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    OrderDTO getOrderById(@PathVariable(name = "id") Long id);
}
